package com.crm.jdy.service.usermanager;

import com.crm.jdy.common.dto.CatalogueInfoDto;
import com.crm.jdy.common.pojo.CatalogueInfo;
import com.crm.jdy.common.mapper.CatalogueInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**   
 * @Description:(目录信息服务实现)
 *
 * @version: V1.0
 * @author: kong
 * 
 */
@Service(version = "${service.version}")
@Component
public class CatalogueInfoServiceImpl  extends ServiceImpl<CatalogueInfoMapper,CatalogueInfo> implements CatalogueInfoService  {

    @Autowired
    CatalogueInfoMapper catalogueInfoDao;


    @Override
    public PageInfo<CatalogueInfo> seleteCatalogueInfo(CatalogueInfoDto catalogueInfoDto) {
        PageHelper.startPage( catalogueInfoDto.getCurrentPage(),catalogueInfoDto.getPageSize());
        List<CatalogueInfo> bookList = catalogueInfoDao.seleteCatalogueInfo(catalogueInfoDto);
        PageInfo<CatalogueInfo> pageInfo = new PageInfo<CatalogueInfo>(bookList);
        return pageInfo;
    }

    @Override
    public boolean updateCatalogueInfo(CatalogueInfo catalogueInfo) {
        return  catalogueInfoDao.updateById(catalogueInfo) > 0;
    }

    @Override
    public boolean addCatalogueInfo(CatalogueInfo catalogueInfo) {
        return  catalogueInfoDao.insert(catalogueInfo) > 0;
    }

    @Override
    public boolean removeCatalogueInfo(String cauid) {
        return  catalogueInfoDao.deleteById(cauid) > 0;
    }

    @Override
    public List<CatalogueInfo> getCatalogueInfo(String userName) {
        return catalogueInfoDao.getCatalogueInfo(userName);
    }


}